package com.xaw4.applejack.simulation;

import java.io.Serializable;


public class Cart implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7198439483343269505L;
	public Vector position = null;
	public static float cartWidth = 3f;
	
	public Cart(Vector position){
		this.position = position;
		
	}
	
	public boolean catchesApple(Apple apple){
		boolean gotcha
			=!( 
				(apple.position.x+Apple.APPLE_RADIUS) < (position.x-cartWidth/2) || // too lefty
				(apple.position.x-Apple.APPLE_RADIUS) > (position.x+cartWidth/2) || // too righty
				(apple.position.y-Apple.APPLE_RADIUS) > (position.y) || //too high
				(apple.position.y+Apple.APPLE_RADIUS) < (position.y) //too low
			);
		
		return gotcha;
		
	}
}
